#import "HazeWaffleController.h"
        
#import "HazeWaffleModel.h"
#import "HazeWaffleCell.h"
#import "Masonry.h"

@interface HazeWaffleController () <UICollectionViewDataSource, UICollectionViewDelegate>

@property (nonatomic, strong) UICollectionView *xenialCollectionView;
@property (nonatomic, strong) NSMutableArray *juggleArr;

@end

@implementation HazeWaffleController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self igniteSymphonySetuplayout];
	[self stillnessIlluminateMergefetchData];
}


//: 获取数据模型
- (void)stillnessIlluminateMergefetchData {
	
}

- (UICollectionView *)xenialCollectionView {
    if (!_xenialCollectionView) {
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        flowLayout.minimumLineSpacing = 10;
        flowLayout.minimumInteritemSpacing = 10;
        flowLayout.itemSize = CGSizeMake(100, 100);
        flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
        
        _xenialCollectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:flowLayout];
        _xenialCollectionView.backgroundColor = UIColor.clearColor;
        _xenialCollectionView.delegate = self;
        _xenialCollectionView.dataSource = self;
        _xenialCollectionView.showsHorizontalScrollIndicator = NO;
        _xenialCollectionView.showsVerticalScrollIndicator = NO;
        [_xenialCollectionView registerClass:[HazeWaffleCell class] forCellWithReuseIdentifier:NSStringFromClass([HazeWaffleCell class])];
    }
    return _xenialCollectionView;
}

//: 初始化页面UI
- (void)igniteSymphonySetuplayout {
	[self.view addSubview:self.xenialCollectionView];
	[self.xenialCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.edges.equalTo(self.view);
	}];
}


//: 懒加载数据模型数组
- (NSMutableArray *)juggleArr {
	if (!_juggleArr) {
		_juggleArr = [NSMutableArray array];
	}
	return _juggleArr;
}

#pragma mark - UICollectionView DataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.juggleArr.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    HazeWaffleCell *yearlingLantern = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([HazeWaffleCell class]) forIndexPath:indexPath];
    return yearlingLantern;
}

#pragma mark - UICollectionView Delegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    //: collectioncell 点击
}


@end
